
<?php



/*



Usage:



You want to calculate 17.5% VAT on a price of £4.67



$price_without_vat = 4.67



echo vat($price_without_vat);



This would return the new amount with 17.5% added, and would be rounded to 2 decimal places



*/



function vat($price_without_vat) {

   

    $vat = 17.5; // define what % vat is

    

    $price_with_vat = $price_without_vat + ($vat*($price_without_vat/100)); // work out the amount of vat

    

    $price_with_vat = round($price, 2); // round to 2 decimal places

    

    return $price_with_vat;

       

}





/**

 * The letter l (lowercase L) and the number 1

 * have been removed, as they can be mistaken

 * for each other.

 */



function createRandomPassword() {



    $chars = "abcdefghijkmnopqrstuvwxyz023456789";

    srand((double)microtime()*1000000);

    $i = 0;

    $pass = '' ;



    while ($i <= 7) {

        $num = rand() % 33;

        $tmp = substr($chars, $num, 1);

        $pass = $pass . $tmp;

        $i++;

    }



    return $pass;



}



// Usage

$password = createRandomPassword();




?> 